using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Acms.SqlDal;

namespace Acms.Bll
{
    public class UserPostUploadAverage : UserPostUpload
    {
        protected UserPostUploadAverage() : base() { }
        protected UserPostUploadAverage(Hashtable table) : base(table) { }
        protected UserPostUploadAverage(Hashtable table, List<UserPostUploadAverage> collection) : base(table, collection) { }

        protected override void Load(Hashtable table)
        {

            base.Load(table);
            average = (decimal)table[UserPostUploadAverageDal.Fields.Average];

        }

        private decimal average;
        public decimal Average
        {
            get { return average; }
        }

        private static UserPostUploadAverage Get(Hashtable table)
        {
            if (table != null)
            {
                return new UserPostUploadAverage(table);
            }
            else
            {
                return null;
            }
        }

        private static List<UserPostUploadAverage> Get(Hashtable[] tables)
        {
            if (tables != null)
            {
                List<UserPostUploadAverage> tmp = new List<UserPostUploadAverage>();
                foreach (Hashtable table in tables)
                {
                    tmp.Add(new UserPostUploadAverage(table, tmp));
                }
                return tmp;
            }
            else
            {
                return null;
            }
        }
        
        public static UserPostUploadAverage GetById(int id)
        {
            UserPostUploadAverageDal dal = new UserPostUploadAverageDal();
            return Get(dal.GetById(id));
        }

    }
}
